﻿using System;
namespace Producers.Etoimik.Xtee.Riik.Ee.Producer.Etoimik {
    
    
    [global::Xtee.Core.Attributes.XmlTypeAttribute(Name="Laekumine", Namespace="http://producers.etoimik.xtee.riik.ee/producer/etoimik", Target=typeof(Laekumine))]
    public class LaekumineSerializer : global::Xtee.Core.Types.AbstractXteeSerializable {
        
        protected ILaekumine clazz;
        
        public LaekumineSerializer(ILaekumine clazz) {
            this.clazz = clazz;
        }
        
        public override void WriteXml(global::Xtee.Core.IXteeXmlWriter Writer) {
            base.WriteXml(Writer);
            if (clazz.KontoNR!=null) {
                Writer.WriteStartElement("KontoNR");
                Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.KontoNR))).ToString());
                Writer.WriteEndElement();
            }
            if (clazz.LaekumiseKP!=null) {
                Writer.WriteStartElement("LaekumiseKP");
                Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "dateTime");
                Writer.WriteString(new global::Xtee.Core.Schema.XsdDateTime(((System.DateTime)(clazz.LaekumiseKP))).ToString());
                Writer.WriteEndElement();
            }
            if (clazz.MaksmiseKP!=null) {
                Writer.WriteStartElement("MaksmiseKP");
                Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "dateTime");
                Writer.WriteString(new global::Xtee.Core.Schema.XsdDateTime(((System.DateTime)(clazz.MaksmiseKP))).ToString());
                Writer.WriteEndElement();
            }
            if (clazz.LaekumiseSumma!=null) {
                Writer.WriteStartElement("LaekumiseSumma");
                Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "decimal");
                Writer.WriteString(new global::Xtee.Core.Schema.XsdDecimal(((decimal)(clazz.LaekumiseSumma))).ToString());
                Writer.WriteEndElement();
            }
            if (clazz.LaekumiseSummaValuutaKL!=null) {
                Writer.WriteStartElement("LaekumiseSummaValuutaKL");
                Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "long");
                Writer.WriteString(new global::Xtee.Core.Schema.XsdLong(((long)(clazz.LaekumiseSummaValuutaKL))).ToString());
                Writer.WriteEndElement();
            }
            if (clazz.MakseId!=null) {
                Writer.WriteStartElement("MakseId");
                Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.MakseId))).ToString());
                Writer.WriteEndElement();
            }
            if (clazz.MaksjaNimi!=null) {
                Writer.WriteStartElement("MaksjaNimi");
                Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.MaksjaNimi))).ToString());
                Writer.WriteEndElement();
            }
            if (clazz.MakseSelgitus!=null) {
                Writer.WriteStartElement("MakseSelgitus");
                Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.MakseSelgitus))).ToString());
                Writer.WriteEndElement();
            }
            if (clazz.Viitenumber!=null) {
                Writer.WriteStartElement("Viitenumber");
                Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.Viitenumber))).ToString());
                Writer.WriteEndElement();
            }
            if (clazz.MakseViisKL!=null) {
                Writer.WriteStartElement("MakseViisKL");
                Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "long");
                Writer.WriteString(new global::Xtee.Core.Schema.XsdLong(((long)(clazz.MakseViisKL))).ToString());
                Writer.WriteEndElement();
            }
            if (clazz.MuutuseLiikKL!=null) {
                Writer.WriteStartElement("MuutuseLiikKL");
                Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "long");
                Writer.WriteString(new global::Xtee.Core.Schema.XsdLong(((long)(clazz.MuutuseLiikKL))).ToString());
                Writer.WriteEndElement();
            }
            if (clazz.MaksjaKood!=null) {
                Writer.WriteStartElement("MaksjaKood");
                Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.MaksjaKood))).ToString());
                Writer.WriteEndElement();
            }
        }
        
        public override void ReadXml(global::Xtee.Core.IXteeXmlReader Reader) {
            base.ReadXml(Reader);
            if (Reader.LocalName=="KontoNR") {
                if ((Reader.IsElementNil() == false)) {
                    clazz.KontoNR = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("KontoNR")).Value;
                }
                else {
                    Reader.Skip();
                }
            }
            if (Reader.LocalName=="LaekumiseKP") {
                if ((Reader.IsElementNil() == false)) {
                    clazz.LaekumiseKP = new global::Xtee.Core.Schema.XsdDateTime(Reader.ReadElementString("LaekumiseKP")).Value;
                }
                else {
                    Reader.Skip();
                }
            }
            if (Reader.LocalName=="MaksmiseKP") {
                if ((Reader.IsElementNil() == false)) {
                    clazz.MaksmiseKP = new global::Xtee.Core.Schema.XsdDateTime(Reader.ReadElementString("MaksmiseKP")).Value;
                }
                else {
                    Reader.Skip();
                }
            }
            if (Reader.LocalName=="LaekumiseSumma") {
                if ((Reader.IsElementNil() == false)) {
                    clazz.LaekumiseSumma = new global::Xtee.Core.Schema.XsdDecimal(Reader.ReadElementString("LaekumiseSumma")).Value;
                }
                else {
                    Reader.Skip();
                }
            }
            if (Reader.LocalName=="LaekumiseSummaValuutaKL") {
                if ((Reader.IsElementNil() == false)) {
                    clazz.LaekumiseSummaValuutaKL = new global::Xtee.Core.Schema.XsdLong(Reader.ReadElementString("LaekumiseSummaValuutaKL")).Value;
                }
                else {
                    Reader.Skip();
                }
            }
            if (Reader.LocalName=="MakseId") {
                if ((Reader.IsElementNil() == false)) {
                    clazz.MakseId = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("MakseId")).Value;
                }
                else {
                    Reader.Skip();
                }
            }
            if (Reader.LocalName=="MaksjaNimi") {
                if ((Reader.IsElementNil() == false)) {
                    clazz.MaksjaNimi = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("MaksjaNimi")).Value;
                }
                else {
                    Reader.Skip();
                }
            }
            if (Reader.LocalName=="MakseSelgitus") {
                if ((Reader.IsElementNil() == false)) {
                    clazz.MakseSelgitus = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("MakseSelgitus")).Value;
                }
                else {
                    Reader.Skip();
                }
            }
            if (Reader.LocalName=="Viitenumber") {
                if ((Reader.IsElementNil() == false)) {
                    clazz.Viitenumber = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("Viitenumber")).Value;
                }
                else {
                    Reader.Skip();
                }
            }
            if (Reader.LocalName=="MakseViisKL") {
                if ((Reader.IsElementNil() == false)) {
                    clazz.MakseViisKL = new global::Xtee.Core.Schema.XsdLong(Reader.ReadElementString("MakseViisKL")).Value;
                }
                else {
                    Reader.Skip();
                }
            }
            if (Reader.LocalName=="MuutuseLiikKL") {
                if ((Reader.IsElementNil() == false)) {
                    clazz.MuutuseLiikKL = new global::Xtee.Core.Schema.XsdLong(Reader.ReadElementString("MuutuseLiikKL")).Value;
                }
                else {
                    Reader.Skip();
                }
            }
            if (Reader.LocalName=="MaksjaKood") {
                if ((Reader.IsElementNil() == false)) {
                    clazz.MaksjaKood = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("MaksjaKood")).Value;
                }
                else {
                    Reader.Skip();
                }
            }
        }
    }
}
